﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;

namespace RGBFinder
{
    public partial class Name : PhoneApplicationPage
    {
        public Name()
        {
            InitializeComponent();
            textBox1.Text = StateAndOptions.state.last_nick == null ? "Player" : StateAndOptions.state.last_nick;
        }

        private void textBox1_TextChanged(object sender, TextChangedEventArgs e)
        {

        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            StateAndOptions.state.last_nick = textBox1.Text;
            NavigationService.Navigate(new Uri("/NewGamePage.xaml", UriKind.Relative));

        }

        bool done;

        protected override void OnNavigatedTo(
                System.Windows.Navigation.NavigationEventArgs e)
        {
            if (done && NavigationService.CanGoBack)
            {
                done = false;
                NavigationService.GoBack();
            }
        }

        protected override void OnNavigatedFrom(
            System.Windows.Navigation.NavigationEventArgs e)
        {
            done = true;
        }


    }
}